import 'dart:convert';

import 'package:common_utils/common_utils.dart';
import 'package:fluro/fluro.dart';
import 'package:talk/pages/device/model/Device.dart';
import 'package:talk/pages/device/qr_code_scanner_page.dart';


import '../../routers/i_router.dart';
import '../provider/data_select.dart';
import 'add.dart';
import 'add_hand.dart';
import 'add_qr.dart';


class XAddRouter implements IRouterProvider{

  static String addPage = '/add';
  static String addHandPage = '/device/addHandPage';
  static String addQrPage = '/device/addQrPage';

  @override
  void initRouter(FluroRouter router) {
    router.define(addPage, handler: Handler(handlerFunc: (_, Map<String, List<String>> params) {

      return AddPage();
    }));

    router.define(addHandPage, handler: Handler(handlerFunc: (_, Map<String, List<String>> params) {
      final String? IdStr = params['deviceType']?.first;
      final int deviceType = int.tryParse(IdStr ?? '0') ?? 0;


      return AddHandPage(deviceType: deviceType);
    }));


    router.define(addQrPage, handler: Handler(handlerFunc: (_, Map<String, List<String>> params) {

      return AddQrPage();
    }));




  }
}
